import dayjs from "dayjs";
const weeks = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
//格式化日期 时间

export const dtFm = (dtSr) => {
  const dt = dayjs(dtSr);
  const day = dt.format("YYYY-MM-DD");
  const week = weeks[dt.day()];
  const n = Math.ceil(dt.diff(dayjs(), "day", true));
  let info = "";
  if (n === 0) {
    info = "今天";
  } else if (n === 1) {
    info = "明天";
  } else if (n === 2) {
    info = "后天";
  } 

  //   return { day: "2022-2-2", week: "周二", info: "今天" };
  return { day, week ,info};
};
